using Cysharp.Threading.Tasks;
using Framework.Manager;
using Framework.StateMechine;
using Game.Hotfix;
using UnityEngine;

namespace Game.Hotfix
{
    public class HotfixEnd : StateBase
    {
        private Game.Hotfix.Hotfix hotfix;
        
        public override async UniTask OnEnter(StateArgs _args)
        {
            Debug.Log("hotfix end.");
            
            hotfix = stateMachine.owner as Game.Hotfix.Hotfix;
            await base.OnEnter(_args);

            // 获取hotfix结果
            // await HotfixManager.Instance.LoadHotfix();

            EventsManager.Instance.Broadcast(new HotfixMsgEvent{ msg = "更新完成，进入游戏"});
            EventsManager.Instance.Broadcast(new HotfixEndEvent());

            // 标记结束
            hotfix.hotfixEnd = true;
        }
    }
}